import axios from "axios"

const service = axios.create({
    baseURL: "https://api.it120.cc/xiaochengxu",
    timeout: 3000
})
// 请求拦截
service.interceptors.request.use((config:any) => {
    if (config.headers["content-type"] != "multipart/form-data") {
        config.headers["content-type"] = "application/x-www-form-urlencoded"
    }
    // 带入登录标识
    // let token = localStorage.getItem("token")
    // if (token) {
    //     config.headers["X-Token"] = token
    // }
    return config
})

service.interceptors.response.use(config => {
    return config.data
})

export default service